﻿
function createCookie(name, value, expireInDays,path) {
    if (name.length == 0) {
        return;
    }
    var cookieAsString = "{0}={1};expires={2};path={3}".format(
        name,
        escape(value),
        daysFromNowToGMT(expireInDays),
        path);
    document.cookie = cookieAsString;
}

function deleteCookie(name) {
    var cookieAsString= "{0}=;expires={1}".format(
        name,
        daysFromNowToGMT(-1)
        );

}

function cookieValueForName(name) {
    var matches = document.cookie.match(new RegExp(
        "(?:^|; )" + name.replace( /([\.$?*|{}\(\)\[\]\\\/\+^])/g , '\\$1') + "=([^;]*)"
	));
    return matches ? unescape(matches[1]) : undefined;
}